package homework5;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;

public class grades {
	public static void main(String[] args) {
		ArrayList<Students> grades1 = new ArrayList<Students>();
		ArrayList<Students> grades2 = new ArrayList<Students>();
		ArrayList<Students> grades3 = new ArrayList<Students>();
		grades1.add(new Students("张三丰", 44, "男"));
		grades1.add(new Students("杨过", 24, "男"));
		grades1.add(new Students("黄蓉", 34, "女"));
		grades2.add(new Students("乔峰", 43, "男"));
		grades2.add(new Students("小龙女", 23, "女"));
		grades2.add(new Students("郭靖", 42, "男"));
		grades3.add(new Students("段玉", 34, "男"));
		grades3.add(new Students("李莫愁", 32, "女"));

		HashMap<String, ArrayList<Students>> grades = new HashMap<String, ArrayList<Students>>();
		grades.put("三年级一班", grades1);
		grades.put("三年级二班", grades2);
		grades.put("三年级三班", grades3);
		Scanner input = new Scanner(System.in);
		System.out.println("输入班级名称：");
		String key = input.next();
		System.out.println("三年级一班的学生列表：");
		ArrayList<Students> values = grades.get(key);
		for (Students stu : values) {
			System.out.println(stu.getName() + "\t" + stu.getGender() + "\t" + stu.getAge());
		}

	}
}
